pub fn convert_base(num_str: &str, to_base: u32) -> String {
    let p: Vec<&str> = num_str[..num_str.len() - 1].split('(').collect();
    let num = p[0];
    let from_base: u32 = p[1].parse().unwrap();

    let mut decimal_num = 0;
    for c in num.to_uppercase().chars() {
        let value = match c {
            '0'..='9' => c as u32 - '0' as u32,
            'A'..='Z' => c as u32 - 'A' as u32 + 10,
            _ => panic!("Unexpected Character"),
        };
        decimal_num = decimal_num * from_base + value;
    }

    if decimal_num == 0 {
        return "0".to_string();
    }

    let mut result = String::new();
    let mut n = decimal_num;
    while n > 0 {
        let remainder = (n % to_base) as u32;
        let digit = if remainder < 10 {
            (remainder as u8 + b'0') as char
        } else {
            char::from_u32(remainder - 10 + b'a' as u32).unwrap()
        };
        result.push(digit);
        n /= to_base;
    }

    result.chars().rev().collect()
}
